package cn.leaf.common.context;

import cn.leaf.common.entity.LoginUser;

/**
 *
 * description: 用户上下文
 *
 * @author twinkle leaf
 * @version v1.0.0
 * @since 2021-11-02 08:53:27
 * slogan: There are no two identical leaves in the world.
 *
 */
public class UserContext {

	private static final ThreadLocal<LoginUser> userHolder = new ThreadLocal<>();

	public static void setUser(LoginUser loginUser) {
		userHolder.set(loginUser);
	}

	public static LoginUser getUser() {
		return userHolder.get();
	}
}
